#include<bits/stdc++.h>
using namespace std;

int a[1000];

int main()
{
	int n;
	cin>>n;
	for(int i = 1;i <= n;i++)
		cin>>a[i];
	cin>>a[n+1];
	int l = 1, r = n;
	int mid;
	sort(a+1, a+n+1);
	while(l <= r)
	{
		mid = l + r >> 1;
		if(a[n+1] == a[mid])
			break;
		if(a[mid] < a[n+1])
			l = mid+1;
		else
			r = mid-1;
	}
//	mid = upper_bound(a+1, a+n+1, a[n+1])-a;
	for(int i = 1;i <= n;i++)
		cout<<a[i]<<" ";
	cout<<endl;
	if(a[mid] != a[n+1])
		cout<<a[n+1]<<":-1";
	else
		cout<<a[n+1]<<":"<<mid-1;
    return 0;
}

